<div class="main-content">
    <div class="section__content section__content--p20">
        <div class="container-fluid">
            <div class="row m-b-30">
                <div class="col-lg-12">
                    <div class="overview-wrap">
                        <h2 class="title-1">个人设置</h2>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <strong>个人设置</strong>
                        </div>
                        <div class="card-body">
                            <form class="form-horizontal" role="form" name="form" id="form" method="post"
                                  data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
                                  data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
                                  data-bv-feedbackicons-validating="glyphicon glyphicon-refresh"
                                  action="index.php?r=admin/admin/edit" data-bv-live="enabled">
                                <input type="hidden" value="<?php echo $userinfo['user_id']; ?>" name="user_id"/>
                                <input type="hidden" name="YII_CSRF_TOKEN" value="<?php echo Yii::app()->request->csrfToken; ?>"/>
                                <input type="hidden" name="role_id" value="<?php echo $userinfo['role_id']; ?>">


                                <div class="form-group">
                                    <label class="control-label mb-1">用户名</label>
                                    <input type="text" class="form-control" disabled="disabled" value=" <?php echo $userinfo['username']; ?>">
                                </div>

                                <div class="form-group">
                                    <label class="control-label mb-1">登入名称</label>
                                    <input type="text" class="form-control" disabled="disabled" value=" <?php echo $userinfo['loginname']; ?>">
                                </div>

                                <div class="form-group">
                                    <label class="control-label mb-1">性别</label>
                                    <?php
                                    if ($userinfo['sex'] == 0) {
                                        ?>
                                        <div >
                                            <label>
                                                <input type="radio" value="1" name="sex"/>男
                                            </label>
                                            <label>
                                                <input type="radio"
                                                       value="0"
                                                       name="sex"
                                                       checked="checked"/>女
                                            </label>
                                        </div>
                                        <?php
                                    } else {
                                        ?>
                                        <div >
                                            <label>
                                                <input type="radio" value="1" name="sex" checked="checked"/>男&nbsp;&nbsp;
                                            </label>
                                            <label>
                                                <input type="radio"
                                                       value="0"
                                                       name="sex"/>女
                                            </label>
                                        </div>
                                        <?php
                                    }
                                    ?>
                                </div>

                                <div class="form-group">
                                    <label class="control-label mb-1">电话</label>
                                    <input type="text" class="form-control " name="tel"
                                           value="<?php echo $userinfo['tel'] ?>" data-bv-notempty data-bv-notempty-message="电话是必须的" />
                                </div>


                                <div class="form-group">
                                    <label class="control-label mb-1">手机</label>
                                    <input type="text" class="form-control " name="phone"
                                           value="<?php echo $userinfo['phone'] ?>" data-bv-notempty data-bv-notempty-message="手机是必须的" />
                                </div>

                                <div class="form-group">
                                    <label class="control-label mb-1">Email</label>
                                    <input type="text" class="form-control " name="email"
                                           value="<?php echo $userinfo['email'] ?>"/>
                                </div>

                                <div class="form-group">
                                    <label class="control-label mb-1">创建时间</label>
                                    <div><?php echo $userinfo['createtime'] ?></div>
                                </div>

                                <div>
                                    <input type="submit" name="submit" id="submit" class="btn btn-lg btn-primary btn-block" value="保存"/>
                                </div>

                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        initPage();
    });
    function initPage() {
        $('#form').bootstrapValidator();
        $('#form').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (formData, jqForm, options) {
                return $('#form').data('bootstrapValidator').isValid();
            },
            success: function (res) {
                if (message(res)) {
                    $('#form').bootstrapValidator('disableSubmitButtons', false);
                }
            }
        });
    }
</script>